﻿Public MustInherit Class clObjeto : Implements IEquatable(Of clObjeto)
    Protected _Nombre As String
    Protected _Usos As Long '-1 = infinito 0 = roto
    'protected _UsosRestante as Long = _Usos
    'protected _Reparable as boolean = false ' crear funcion renovar
    Protected _Definicion As String
    Protected _imagen As Image
    Protected _descripcion As String
    Public Enum ElTipo
        Cabeza
        Brazos
        Cuerpo
        Manos
        Pies
        Arma
        Comun
    End Enum
    Public Property Tipo As ElTipo

    Public ReadOnly Property Nombre As String
        Get
            Return _Nombre
        End Get
    End Property
    Public ReadOnly Property Usos As Long
        Get
            Return _Usos
        End Get
    End Property
    Public ReadOnly Property Roto As Boolean
        Get
            Return _Usos = 0
        End Get
    End Property


    ''' <summary>
    ''' Desgasta el objeto y lo confirma con True. Si no puede desgastarlo devuleve False.
    ''' </summary>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Function Desgaste() As Boolean
        If _Usos <= 0 Then Return False
        _Usos -= 1
        Return True
    End Function
    Public Overloads Shared Function Equals(ByVal objetoA As clObjeto, ByVal ObjetoB As clObjeto) As Boolean
        Return objetoA._Nombre = ObjetoB._Nombre And objetoA._Tipo = ObjetoB._Tipo
    End Function
    Public Overloads Function Equals(ByVal other As clObjeto) As Boolean Implements System.IEquatable(Of clObjeto).Equals
        Return Equals(Me, other)
    End Function
End Class
